-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add max click timings & distance to Options
#4986
Conversation
.interactions | ||
.entry(self.memory.viewport_id) | ||
.or_default(), | ||
&self.memory.options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't super pretty, but otherwise it conflicts with the mut access of memory
above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but we need to fix that deadlock
@@ -2721,7 +2721,7 @@ fn register_rect(ui: &Ui, rect: Rect) { | |||
return; | |||
} | |||
|
|||
let is_clicking = ui.input(|i| i.pointer.could_any_button_be_click()); | |||
let is_clicking = ui.memory(|m| ui.input(|i| i.pointer.could_any_button_be_click(&m.options))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This deadlocks (try holding down all modifier keys in the demo app)
There is an alternative PR for this in #4942 which I think uses a slightly better approach, and avoids the deadlock |
Oh I totally missed it! Yeah I agree that other one is a lot cleaner 👌 I'll close this one |
Moves the click timing & distance constants to the Options struct so they can be configured by users.
Note: This need came up as part of my investigation of vladbat00/bevy_egui#302. Essentially, on some platforms we are not guaranteed to have correct timekeeping so it's useful to be able to disable the max click duration in this case.